package users

import (
	"context"
	"github.com/gogf/gf/v2/frame/g"
	"shenmawl/api/user/v1"
)

func (c *NoRBACControllerV1) UserVerifyVCode(ctx context.Context, req *v1.VerifyVCodeReq) (res *v1.VerifyVCodeRes, err error) {
	resData, err := c.usersNoRBAC.VerifyCaptcha(ctx, req.Id, req.VCode)
	if err != nil {
		return nil, err
	}
	if resData {
		g.RequestFromCtx(ctx).Response.WriteJson(&v1.VerifyVCodeRes{
			Code: 200,
			Msg:  "验证码正确",
		})
	}
	return nil, err
}
